"use strict";
import * as React from 'react';
import { SCREEN_WIDTH } from "../constant";
import { commonStyles } from "../assets/styles/common";
const { View, ScrollView, Image, ActionSheetIOS } = require('react-native');
const ImagePicker = require('react-native-image-picker');
import ImagePicker1 from 'react-native-image-crop-picker';
const { Actions } = require("react-native-router-flux");
class MyImagePicker extends React.Component {
    constructor(props, context) {
        super(props, context);
    }
    static showImagePicker(options, cb) {
        const _options = {
            title: null,
            cancelButtonTitle: '取消',
            takePhotoButtonTitle: '拍摄照片',
            chooseFromLibraryButtonTitle: '选择现有照片',
            customButtons: null,
            cameraType: 'back',
            mediaType: 'photo',
            maxWidth: SCREEN_WIDTH,
            allowsEditing: false,
        };
        ImagePicker.showImagePicker(_options, (response) => {
            if (response.didCancel) {
            }
            else if (response.error) {
            }
            else if (response.customButton) {
            }
            else {
                ImagePicker1.openCropper(Object.assign({ mediaType: 'photo' }, options, { path: response.uri })).then(image => {
                    cb(image);
                }).catch((e) => {
                });
            }
        });
    }
    static launchCamera(options, cb) {
        ImagePicker.launchCamera(options, cb);
    }
    static launchImageLibrary() {
    }
    render() {
        return (<View style={[commonStyles.container, commonStyles.centerVH, { backgroundColor: 'rgba(0,0,0,0.5)' }]}>

            </View>);
    }
}
export default MyImagePicker;
